#include "StateGameover.h"

#include "userStates.h"

#include "StringUtility.h"

StateGameover::StateGameover()
{
    score = 0;

    gameOverText.loadFont("fonts/unispace.ttf",24);
    gameOverText.setColour(WHITE);

    GFX::setClearColour(BLACK);
}

StateGameover::~StateGameover()
{

}

void StateGameover::userInput()
{
    input->update();

    // This is triggered when the user presses the close button (X) on a PC and ensures it actually closes the window
#ifdef PLATFORM_PC
    if(input->isQuit())
    {
        nullifyState();
        return;
    }
#endif

    if (input->isAny())
    {
        // actually proceed to highscore state here
        setNextState(STATE_MAIN);
    }

    input->resetKeys();
}

void StateGameover::update()
{
    //
}

void StateGameover::render()
{
    GFX::clearScreen();

    gameOverText.setPosition(50,50);
    gameOverText.print("GAME OVER!");
    gameOverText.setPosition(50,100);
    gameOverText.print("Score: " + StringUtility::intToString(score));
    gameOverText.setPosition(50,200);
    gameOverText.print("Press any key");
}
